#include <iostream>
#include <string>
#include "TROOT.h"
#include "TApplication.h"
#include "TRandom.h"
#include "TMath.h"

#include "DDMainWindow.hh"
#include "TEveManager.h"
#include "DDEventManager.hh"

#include "DDVData.hh"
#include "DDDummyData.hh"
#include "DDVDAQ.hh"
#include "DDDummyDAQ.hh"
#include "DDVAnalysis.hh"
#include "DDChargeAnalysis.hh"

int main(int argc, char** argv) {

  std::cout << "======================================" << std::endl;
  std::cout << "  Duke Neutrino Group DAQ Utility" << std::endl;
  std::cout << "======================================" << std::endl;

  std::string inputZBS;

//   if (argc!=2) {
//     std::cout << "usage: glSK [zbs file]" << std::endl;
//     return 0;
//   }
//   else {
//     inputZBS = argv[1];
//   }

  TApplication app("main",&argc, argv);
  
  DDDummyDAQ dummy;

  dummy.config.load_config();
  //cout << "instantiated dummy" << endl;
  dummy.acquire_data();

  // Read in settings here

  // Define the Scope Stuff here

  // Define Event Manager
  // This is what performs the analysis and does the draw after each event
  DDEventManager* eventManager = new DDEventManager;
  //TEveManager* eveMan = TEveManager::Create();

  // Instantiate Data classes

  DDDummyData DummyData;
  DDVData * data = &DummyData;
  string DummyDataName = "DummyData";
  eventManager->RegisterDataClass(data, DummyDataName);

  // Instantiate Analysis classes

  DDChargeAnalysis ChargeAnalysis;
  DDVAnalysis * analysis = &ChargeAnalysis;
  string ChargeAnalysisName= "ChargeAnalysis";
  eventManager->RegisterAnalysisClass(analysis, ChargeAnalysisName);

//  eventManager->MakeEventNavGui(eveMan);
  //eventManager->Initialize(eveMan);

  // Start the Gui
  DDMainWindow mainWindow( eventManager );
  
  app.Run();


  return 0;
}
